home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / relay_mz.arc / RELAY-MZ.SLT < prev   
Text File  |  1991-05-19  |  40KB  |  1,063 lines

  1. //  Telix script modified for ProDoor Prompts & Modem Zone Language Prompt
  2. //  Modify information in first 35 lines to match your system.
  3. int TRUE = 1 ;
  4.  
  5. //
  6. //  DSZ work areas
  7. //
  8.  str Protocol[60] = "C:\TELIX\DSZ.COM" ;         // Complete path to DSZ
  9.  str Send_Command[64] = " handshake on sz ";     // Cmnd passed to DSZ to send
  10.  str Recv_Command[64] = " rz ";                  // Cmnd passed to DSZ to rcv
  11.  str DSZ_Screen_Log[64] = "C:\TELIX\SCREEN.DSZ"; // Screen log file
  12.  str DSZLOG[64] = "C:\TELIX\$DOOR.LOG";          // DSZLOG file name
  13.  str logwork[100];                               // DSZLOG work area
  14.  int fh;                                         // file handle for DSZLOG
  15.  
  16. //
  17. //  User name
  18. //
  19.  str user_name[20] = "NODE CONFORUM";      // user name for logon
  20.  str node_name[8] = "CONFORUM";            // Name of node getting mail
  21.  str hub_name[8]  = "HUBZN";               // Name of HUB you are contacting
  22.  str dial_str[10] = "3 1";                 // string of dial directory entries
  23.  int dial_cnt = 100;                       // number of times to dial
  24.  str hub_door[2]  = "22";                  // door to be used on hub
  25.  str hub_conf[2]  = "0";                   // conference to be used on hub
  26.  
  27. //
  28. //  Mail work area
  29. //
  30.   str Mail_upload[64] = "C:\TELIX\";             // dir of node upload file
  31.   str Mail_download[64] = "C:\TELIX\";           // dir of node download file
  32.   str Mail_save_dir[64] = "C:\TELIX\BACKUPS\";   // dir of mail save area
  33.   str Mail_log_file[64] = "C:\TELIX\RELAY.LOG";  // log file for messages
  34.   str Mail_run_good[] = "C:\TELIX\COMM.OK";      // file to create if good
  35.   str Save_count[3] = "3";                       // nbr of IN.RLY backups kept
  36.  
  37. //
  38. // Misc work areas
  39. //
  40.  str message_work[64];                       // work area for message
  41.  str node_packet[64];                        // U/L packet name
  42.  str node_file[64];                          // U/L full file name
  43.  str up_packet[64];                          // U/L packet name
  44.  str up_file[64];                            // U/L full file name
  45.  str Mail_packet[64];                        // D/L packet name
  46.  str Mail_file[64];                          // D/L full file name
  47.  str node_time[16];                          // work area for message
  48.  str node_date[16];                          // work area for message
  49.  str node_size[16];                          // work area for message
  50. // str comm_byte[1];                           // work area for screen
  51. // str screen_line1[78];                       // work area for screen
  52. // str screen_line2[78];                       // work area for screen
  53. // str screen_line3[78];                       // work area for screen
  54. // str screen_line4[78];                       // work area for screen
  55. // str screen_line5[78];                       // work area for screen
  56. // str screen_line6[78];                       // work area for screen
  57. // str screen_line7[78];                       // work area for screen
  58. // str screen_line8[78];                       // work area for screen
  59. // str screen_line9[78];                       // work area for screen
  60.  int n_isize = 0;                            // work area for message
  61.  int n_itime;                                // work area for message
  62.  int error_count;                            // keeps track of logon errors
  63.  int first_time = 0;                         // screen write logic control
  64.  
  65. //
  66. // Work areas used to reset system values
  67. //
  68.  str old_down_dir[64];                       // old download directory
  69.  str old_up_dir[64];                         // old upload directory
  70.  int old_alarm_on;                           // old alarm value
  71.  int old_zmod_auto;                          // old auto zmodem d/l
  72.  
  73.  int debug;                                  // debugging flag
  74.  
  75.  int stat;
  76.  int str_len;
  77.  
  78.  int tmark;                                  // Timer pop value
  79.    int Door_Timer;                           // Timer used for open door cmd
  80.    int DialStat;                             // Status from dialing the hub
  81.    int LogonStat;                            // Status returned from logon rtn
  82.    int SendStatus;                           // Used for send R/C from DSZ
  83.    int RecvStatus;                           // Used for receive R/C from DSZ
  84.    int TrackStatus;                          // Track status of join conf cmd
  85.    int trMainCMDprompt;                      // Track Main Conf prompt
  86.    int trConfCMDprompt;                      // Track Conf Prompt
  87.    int trMailDoorReady;                      // Track Mail door ready
  88.    int trDSZDLPrompt;                        // track DSZ D/L '**'
  89.    int trMsgPrompt;                          // Track messages prompt
  90.    int TimerHandle;                          // Timer track for logon
  91.  
  92.    str sizestring[10] ;
  93.    str Join_Command[16] = "J " ;
  94.    str Open_Command[16] = "OPEN " ;
  95.    str One_line[80];
  96.    str One_liner[80];
  97.  
  98. main()
  99. {
  100.        _time_format = 1;                     // use 24-hour format time
  101.  
  102.    screen();                                 // send screen
  103.    load_values();                            // load values from cfg
  104.    Telix_init();                             // control telix files
  105.    gotoxy(59,6);                             // position cursor  = 6
  106.    printsc("In Progress ..");                // startup in progress
  107.    screen();                                 // send initial screen
  108.    del_dszlog();                             // clear out DSZLOG
  109.    gotoxy(59,6);                             // position cursor  = 6
  110.    printsc("Complete       ");               // startup in progress
  111.    gotoxy(59,7);                             // position cursor  = 7
  112.    printsc("Not Available Yet");             // Starlink/PCP status
  113.        debug = 0;                            // debug off
  114.    gotoxy(59,8);                             // position cursor  = 8
  115.    printsc("Dialing Hub");                   // Logon status
  116.  
  117.  dial_BBS:
  118.  
  119. //
  120. //  Dial the hub for the specified period of time.
  121. //
  122.    if (not carrier ())
  123.       {
  124.         hangup();
  125.         cputs_tr("ATZ~^M");                  // reset the modem
  126.         delay(20);
  127.         cputs_tr("AT~S7=45S0=0S11=40V1E1X7&B1&H1&K0M0L3^M~~");
  128.         delay(20);
  129.         ustamp( "Beginning dial attempt." , 1 , 1 ) ;
  130.         DialStat = dial(dial_str , dial_cnt , TRUE ) ;
  131.       }
  132.  
  133.    delay(50);                       // wait for a carrier
  134.    if (not carrier ())
  135.       {
  136.         ustamp("unable to connect to HUB",1,1);
  137.         ustamp( "Relay failed: Dialing Timeout." , 1 , 1 ) ;
  138.         ustamp( "------------------------------" , 1 , 1 ) ;
  139.         cputs_tr("ATH1~^M");        // exit after giving up
  140.         exittelix( 1 , 1 ) ;
  141.       }
  142.  screen();                            // reset to correct baud rate
  143.  if (not _entry_pass)                 // Check for Correct Password
  144.   {
  145.    alarm(1);
  146.    prints ("Sorry, I can't find the password for this BBS!");
  147.    cputs_tr("ATH1~^M");
  148.    goto halt_telix;
  149.    }
  150.  
  151.  if ( ( LogonStat = logon() ) != 0) {
  152.         alarm( 1 ) ;
  153.         status_wind( "Logon failed - TIMEOUT" , 2 ) ;
  154.         ustamp( "Relay Failed:  Logon Timeout" , 1 , 1 ) ;
  155.         ustamp( "------------------------------" , 1 , 1 ) ;
  156.         error_count = Error_count + 1;
  157.         if (error_count == 5) {
  158.            capture( "*CLOSE*" ) ;
  159.            exittelix( 1 , 1 ) ;
  160.            }
  161.         Hangup();
  162.         goto Dial_BBS;
  163.     }
  164.  
  165. //
  166. //  We are now sitting at the main board command prompt.  Set up a couple
  167. //  of tracks to get us to the mail door and a timer just in case.
  168. //
  169.    gotoxy(59,9);                             // position cursor   = 9
  170.    printsc("Pending          ");             // Conf Join
  171.    if ( TrackStatus == trMsgPrompt )
  172.         cputs( "N^M" ) ;
  173.    if ( TrackStatus == trMailDoorReady )
  174.         goto sendit;
  175.  
  176.  
  177. resend:                                      // Branch point to reopen door
  178.  
  179.     Track_free(0);                           // Free all tracks
  180.     
  181.     trMainCMDPrompt = track( "Command?" , 0 ) ;
  182.     trConfCMDPrompt = track( "Conference Command?" , 0 ) ;
  183.     trMailDoorReady = track( Open_Command , 0 ) ;
  184.     trMsgPrompt     = track( " personal mail: (Enter)=yes? " , 0 );
  185.  
  186.     Door_Timer = timer_start( 1800 ) ;
  187.     if ( Hub_conf != "0")
  188.        {
  189.         gotoxy(59,9);                        // position cursor  = 9
  190.         printsc("Joining Conf      ");       // Conf Join
  191.         cputs( Join_Command ) ;
  192.        }
  193.       else
  194.        {
  195.         gotoxy(59,9);                        // position cursor  = 9
  196.         printsc("Not Needed        ");       // Conf Join
  197.         gotoxy(59,10);                       // position cursor  = 10
  198.         printsc("Opening Door      ");       // Conf Join
  199.         cputs( Open_command );               // open the door
  200.        }
  201.  
  202.  
  203.     while ( ! time_up( Door_Timer ) ) {
  204. //      if (cinp_cnt()) {                    // Process any characters and keys
  205. //          Comm_byte = cgetc();
  206. //          track_addchr(comm_byte);
  207. //          screen_io();
  208. //          }
  209.          if (cinp_cnt())
  210.              track_addchr(cgetc());
  211.  
  212.         TrackStatus = track_hit(0);          // Determine which track (if any)
  213.  
  214.         if (TrackStatus == 0)
  215.             continue;
  216.  
  217.         if ( TrackStatus == trConfCMDPrompt ) {
  218.             if (hub_conf != "0")
  219.                {
  220.                 gotoxy(59,9);                 // position cursor  = 9
  221.                 printsc("Conference Joined"); // Conf Join
  222.                 gotoxy(59,10);                // position cursor  = 10
  223.                 printsc("Opening the door "); // Conf Join
  224.                 cputs( Open_Command ) ;
  225.                } else
  226.                 cputs( "A^M" );
  227.  
  228.  
  229.             track_free( trConfCMDPrompt ) ;
  230.         }
  231.  
  232.         if ( TrackStatus == trMainCMDPrompt ) {
  233.                 gotoxy(59,9);                 // position cursor  = 9
  234.                 printsc("Not Needed       "); // Conf Join
  235.                 gotoxy(59,10);                // position cursor  = 10
  236.                 printsc("Opening door     "); // Conf Join
  237.                 cputs( Open_Command ) ;
  238.                 track_free( trConfCMDPrompt ) ;
  239.            }
  240.  
  241.         if ( TrackStatus == trMsgPrompt )
  242.              cputs( "N^M" ) ;
  243.         if ( TrackStatus == trMailDoorReady )
  244.              break ;
  245.  
  246.     }
  247.  
  248.     if ( time_up( Door_Timer ) ) {      // failed to open door
  249.         ustamp( "Relay Failed:  No Door! " , 1 , 1 ) ;
  250.         ustamp( "------------------------------" , 1 , 1 ) ;
  251.         cputs( "g^M" ) ;
  252.         exittelix( 1 , 1 ) ;
  253.     }
  254. //
  255. //  We are at the door and ready to send!
  256. //
  257.  
  258. sendit:                        //jump point for ProLogon door menu
  259.  
  260.   timer_free(Door_Timer);                    // Free timer channel
  261.   track_free(0);                             // and all track channels
  262.  
  263.   upload_log();                             // log what we are sending
  264.  
  265.   gotoxy(59,10);                            // position cursor =  10
  266.   printsc("Door now open");                 // Door status
  267.   gotoxy(59,11);                            // position cursor = 11
  268.   printsc("In progress");                   // Upload status
  269.  
  270.   delay(90);
  271.  
  272.   if (not carrier())                         // If we lost carrier
  273.      goto dial_BBS;                          // go try calling again
  274.  
  275. //
  276. //  We are at the door and ready to send!
  277. //
  278.     SendStatus = run( Protocol , Send_Command , 0 ) ;
  279. //
  280. //  Stamp the log with the size of the file sent
  281. //
  282.     if ( SendStatus == 0 ) {
  283.         gotoxy(59,11);                        // position cursor  = 11
  284.         printsc("Successful     ");           // Upload status
  285.         ustamp( "Relay Upload successful."    , 1, 1 ) ;
  286.         copy_dszlog();
  287.     } else {
  288.         gotoxy(59,11);                        // position cursor  = 11
  289.         printsc("Aborted        ");           // Upload status
  290.         ustamp( "Relay Failed:  Send failed."    , 1 , 1 ) ;
  291.         ustamp( "------------------------------" , 1 , 1 ) ;
  292.         Hangup();
  293.         exittelix( 1 , 0 ) ;
  294.     }
  295.  
  296.     TimerHandle = timer_start( 50 ) ;         // wait for 5 seconds
  297.  
  298.     while ( not time_up( TimerHandle ) ) {
  299.          if (cinp_cnt())
  300.              track_addchr(cgetc());
  301.  
  302.         }
  303.  
  304.     trMainCMDPrompt  = track( "Command?" , 0 );
  305.     trConfCMDPrompt  = track( "Conference Command?" , 0 ) ;
  306.     trDSZDLPrompt    = track( "**" , 1 ) ;
  307.  
  308.     gotoxy(59,12);                            // position cursor  = 12
  309.     printsc("Awaiting start");                // Download status
  310.  
  311. //
  312. //  After 5 minutes the logon is assumed to have failed.
  313. //
  314.     TimerHandle = timer_start( 9000 ) ;      // wait for 15 minutes
  315.  
  316.     while ( not time_up( TimerHandle ) ) {
  317. //       if (cinp_cnt()) {                    // Process any characters and keys
  318. //          Comm_byte = cgetc();
  319. //          track_addchr(comm_byte);
  320. //          screen_io();
  321. //          }
  322.          if (cinp_cnt())
  323.              track_addchr(cgetc());
  324.  
  325.         trackStatus = track_hit(0);  // Determine which track (if any)
  326.  
  327.         if (trackStatus == 0)
  328.             continue;
  329.  
  330.         if ( trackStatus == trConfCMDPrompt ) {
  331.             timer_free(TimerHandle);         // Free timer channel
  332.             track_free(0);                   // and all track channels
  333.             goto resend;
  334.          } else if ( trackStatus == trMainCMDPrompt ) {
  335.             timer_free(TimerHandle);         // Free timer channel
  336.             track_free(0);                   // and all track channels
  337.             goto resend;
  338.          } else if ( trackStatus == trDSZDLPrompt ) {
  339.             timer_free(TimerHandle);         // Free timer channel
  340.             track_free(0);                   // and all track channels
  341.             gotoxy(59,12);                   // position cursor
  342.             printsc("Started            ");  // Download status
  343.             ustamp("Receive of mail packet started", 1, 1);
  344.             RecvStatus = run( Protocol , Recv_command , 0 );
  345.             break;
  346.          }
  347.         }
  348.  
  349.  
  350. //
  351. //  Stamp the log with the size of the file received
  352. //
  353.     if ( RecvStatus == 0 ) {
  354.          gotoxy(59,12);                      // position cursor
  355.          printsc("Successful");              // Download status
  356.          download_log();                     // log successful transfer
  357.          copy_dszlog();                      // save DSZ information
  358.          hangup();                           // Hang up on hub
  359.          cputs_tr("AT H1^M");                // keep phone off hook
  360.          Mail_save();                        // Save the Mail after xfer
  361.          logwork = "ECHO Transfer Good! > "; // let's build Good file
  362.          strcat(logwork, Mail_run_good);     // add target name
  363.          dos(logwork, 2);                    // do command
  364.          Ustamp(logwork, 1, 0);              // log command
  365.          Ustamp(" performed", 0, 1);
  366.     } else {
  367.          copy_dszlog();                      // save dsz information
  368.          gotoxy(59,12);                      // position cursor
  369.          printsc("Aborted   ");              // Download status
  370.          gotoxy(59,13);                      // position cursor
  371.          printsc("IN.RLY deleted");          // Mail Save status
  372.          logwork = "DEL ";                   // Build DEL command
  373.          strcat(logwork, Mail_file);         // Add D/L file name
  374.          strcat(logwork, " >NUL");           // Send O/P to null
  375.          dos(logwork, 2);                    // execute dos command
  376.          ustamp( "Relay Failed:  Receive failed." , 1 , 1 ) ;
  377.          Ustamp( Mail_file, 1, 0);
  378.          Ustamp( " has been deleted.", 0, 1);
  379.          ustamp( "------------------------------" , 1 , 1 ) ;
  380.          Hangup();
  381.          exittelix(1,0);
  382.     }
  383.  
  384.   //
  385.   //  reset all default values
  386.   //
  387.  
  388.   _down_dir = old_down_dir;           // Reset Download/Upload Directories
  389.   _up_dir = old_up_dir;               // to their Normal Settings
  390.   delay(1);
  391.   cputs_tr("ATH1~^M");                // exit with phone off hook,
  392.   ustamp( "------------------------------", 1 , 1 ) ;
  393.   usagelog( "*CLOSE*" ) ;
  394.   capture("*CLOSE*");
  395.   dos( "del hubrelay.cap > NUL" , 2 ) ;
  396.   exittelix(0, 1);
  397.  
  398.   //
  399.   //   exit script on password error in directory
  400.   //
  401.  
  402. halt_telix:
  403.   prints("Please edit the Dialing Directory entry and enter");
  404.   prints("a PASSWORD for it.");
  405.  
  406. }
  407.  
  408. //*****************************************************************************
  409. //
  410. // Screen() builds the mail transfer user screen
  411. //
  412. //*****************************************************************************
  413.  
  414.  screen() {
  415.  
  416. //
  417. //    clear the screen and build default headings and colors
  418. //
  419.       if (first_time == 0)
  420.          {
  421.            _back_color = 01;                 // Set background to blue
  422.            _fore_color = 15;                 // Set Foreground to white
  423.            clear_scr();                      // clear the screen
  424.            box( 0,0,79,23,0,1,31);           // color the whole screen
  425.          }
  426.  
  427. //
  428. //    Show script start time in upper left corner
  429. //
  430.       if (first_time == 0)
  431.          {
  432.           date(curtime(), logwork);
  433.           gotoxy(0, 0);
  434.           printsc("Start Date: ");
  435.           printsc(logwork);
  436.           time(curtime(), logwork);
  437.           gotoxy(0, 1);
  438.           printsc("      Time: ");
  439.           printsc(logwork);
  440.          }
  441.  
  442. //
  443. //    Draw RelayNet Transmission box on top center of screen
  444. //
  445.       if (first_time == 0)
  446.          {
  447.            box( 20, 0,59, 2, 2, 0,31);       // draw Relaynet box
  448.            pstraxy("RelayNet(tm) Transmission", 28, 1,11);
  449.          }
  450.  
  451. //
  452. //    Draw box on bottom of screen for captured data to be displayed
  453. //
  454.       if (first_time == 0)
  455.          {
  456.            box(0,16,79,23,2,0,31);
  457.            gotoxy(14,20);
  458.     //     printsc("Area reserved for screen I/O when I figure out how!");
  459.          }
  460.  
  461. //
  462. //    Draw left-hand side box and fill in values
  463. //
  464.       if (first_time == 0)
  465.          {
  466.            box(0,3,39,15,2,0,31);                 // draw left side box
  467.            gotoxy(1,4);                           // position cursor
  468.            printsc("      Node ID: ");            // who is calling
  469.            gotoxy(1,5);                           // position cursor
  470.            printsc("Connecting to: ");            // where are you calling
  471.            gotoxy(1,6);                           // position cursor
  472.            printsc("    Baud Rate: ");            // move in connect speed
  473.            gotoxy(1,7);                           // position cursor
  474.            printsc("    Comm Port: ");            // identify which comm port
  475.            gotoxy(1,8);                           // position cursor
  476.            printsc("    User Name: ");            // label user login id
  477.            gotoxy(1,9);                           // position cursor
  478.            printsc("   Upload Dir: ");            // label mail upload dir
  479.            gotoxy(1,10);                          // position cursor
  480.            printsc("       Packet: ");            // label upload file name
  481.            gotoxy(1,11);                          // position cursor
  482.            printsc("  Create Date: ");            // label create date
  483.            gotoxy(1,12);                          // position cursor
  484.            printsc("         Time: ");            // label create time
  485.            gotoxy(1,13);                          // position cursor
  486.            printsc("  Packet Size: ");            // label upload size
  487.            gotoxy(1,14);                          // position cursor
  488.            printsc(" Download Dir: ");            // label dir name
  489.          }
  490.       gotoxy(16,4);                          // position cursor
  491.       printsc(Node_name);                    // move in node name
  492.       gotoxy(16,5);                          // position cursor
  493.       printsc(hub_name);                     // move in hub name
  494.       gotoxy(16,6);                          // position cursor
  495.       printn(get_baud());                    // print out baud rate
  496.       gotoxy(16,7);                          // position cursor
  497.       printn(get_port());                    // print out commport value
  498.       gotoxy(16,8);                          // position cursor
  499.       printsc(user_name);                    // print off user name
  500.       gotoxy(16,9);                          // position cursor
  501.       printsc("                      ");     // print off value
  502.       gotoxy(16,9);                          // position cursor
  503.       strupper(_up_dir);                     // convert string to upper
  504.       printsc(_up_dir);                      // print off value
  505.       gotoxy(16,10);                         // position cursor
  506.       printsc(up_packet);                    // print off file name
  507.       gotoxy(16,11);                         // position cursor
  508.       printsc("                ");           // print off create date
  509.       gotoxy(16,11);                         // position cursor
  510.       printsc(node_date);                    // print off create date
  511.       gotoxy(16,12);                         // position cursor
  512.       printsc(node_time);                    // print off create time
  513.       gotoxy(16,13);                         // position cursor
  514.       printsc(node_size);                    // print off file size
  515.       gotoxy(16,14);                         // position cursor
  516.       printsc("                      ");     // print off value
  517.       gotoxy(16,14);                         // position cursor
  518.       strupper(_down_dir);                   // convert string to upper
  519.       printsc(_down_dir);                    // print mail target dir
  520.  
  521. //
  522. //  draw box on right-hand side of screen
  523. //
  524.       if (first_time == 0)
  525.          {
  526.            box(40,3,79,15,2,0,31);                    // draw right box
  527.            gotoxy(41,4);                              // position cursor
  528.            printsc("        Current Session Status"); // heading
  529.            gotoxy(41,5);                              // position cursor
  530.            printsc("        ----------------------"); // heading
  531.            gotoxy(41,6);                              // position cursor
  532.            printsc("  Initialization:");              // startup status
  533.            gotoxy(41,7);                              // position cursor
  534.            printsc("    StarLink/PCP:");              // Starlink status
  535.            gotoxy(41,8);                              // position cursor
  536.            printsc("           Logon:");              // logon status
  537.            gotoxy(41,9);                              // position cursor
  538.            printsc(" Conference Join:");              // conf join status
  539.            gotoxy(41,10);                             // position cursor
  540.            printsc("    Opening Door:");              // door status
  541.            gotoxy(41,11);                             // position cursor
  542.            printsc("          Upload:");              // upload status
  543.            gotoxy(41,12);                             // position cursor
  544.            printsc("        Download:");              // download status
  545.            gotoxy(41,13);                             // position cursor
  546.            printsc("Mail file backup:");              // backup status
  547.            gotoxy(59,6);                              // position cursor
  548.            printsc("In Progress .");                  // startup in progress
  549.            gotoxy(59,6);                              // position cursor
  550.          }
  551.  
  552.       if (first_time == 0)
  553.           first_time = 1;
  554.  
  555. }
  556. //*****************************************************************************
  557. //
  558. // Logon() logs on to a ProLogon/ProDoor host.
  559. //
  560. //*****************************************************************************
  561.  
  562. Logon() {
  563.  
  564.     str ENTER[2] = "^M" ;
  565.  
  566.     int trGraphicsPrompt, trNamePrompt, trPWPrompt, trEnterPrompt;
  567.     int trMsgPrompt, trConfCMDPrompt , trMainCMDPrompt , trMorePrompt ;
  568.     int trLangPrompt , trProLogonPrompt ;
  569.     int trStatus , TimerHandle, ShortTimer ;
  570.     trLangPrompt     = track( "(Enter)='1'? ", 0 );
  571.     trGraphicsPrompt = track( "graphics: (Enter)=no? " , 0 );
  572.     trNamePrompt     = track( "name?" , 0 );
  573.     trPWPrompt       = track( "password?" , 0 );
  574.     trEnterPrompt    = track( "Press (Enter) to continue:" , 0 );
  575.     trMsgPrompt      = track( " personal mail: (Enter)=yes? " , 0 );
  576.     trProLogonPrompt = track( "stem (Enter)='1'? " , 0 );
  577.     trMainCMDPrompt  = track( "Command?" , 0 );
  578.     trConfCMDPrompt  = track( "Conference Command?" , 0 ) ;
  579.     trMorePrompt     = track( "(NS)non-stop?" , 0 ) ;
  580.     trProLogonPrompt = track( "ystem (Enter)='1'? " , 0 ) ;
  581. //
  582. //  Build the commands for one line logon (ProLogon)
  583. //
  584.  
  585.    One_line = "1 N QQ ";
  586.    One_liner = "N QQ ";
  587.    strcat(One_line , User_Name);
  588.    strcat(One_liner , User_Name);
  589.    strcat(One_line , " ");
  590.    strcat(One_liner , " ");
  591.    strcat(One_line , _entry_pass);
  592.    strcat(One_liner , _entry_pass);
  593.    strcat(One_line , " ");
  594.    strcat(One_liner , " ");
  595.    strcat(One_line , Hub_Door);
  596.    strcat(One_liner , Hub_Door);
  597.    strcat(One_line , " ");
  598.    strcat(One_liner , " ");
  599.    strcat(One_line , "NS");
  600.    strcat(One_liner , "NS");
  601.    strupper(One_line);
  602.    strupper(One_liner);
  603.  
  604. //
  605. //  After 3 minutes the logon is assumed to have failed.
  606. //
  607.     TimerHandle = timer_start( 1800 ) ;      //  3 min time to logon
  608.     ShortTimer  = timer_start(  100 ) ;      //  10 secs for graphics
  609.  
  610.     while ( not time_up( TimerHandle ) ) {
  611.         if (cinp_cnt())              // Process any characters and keys
  612.             track_addchr(cgetc());
  613.  
  614.         trStatus = track_hit(0);     // Determine which track (if any)
  615.  
  616.         if (time_up (ShortTimer) ) {
  617.             track_free(0);
  618.             timer_free (TimerHandle);
  619.             timer_free (ShortTimer);
  620.             gotoxy(59,8);
  621.             printsc("Completed         ");
  622.             gotoxy(59,10);
  623.             printsc("Opening door     ");
  624.             cputs( One_liner ) ; cputs( ENTER ) ;
  625.             return ( 0 ) ;
  626.         }
  627.  
  628.  
  629.         if (trStatus == 0)
  630.             continue;
  631.  
  632.  
  633.         if (trStatus == trLangPrompt) {
  634.            cputs ( One_line ) ; cputs( ENTER ) ;
  635.             track_free(0);
  636.             timer_free (TimerHandle);
  637.             timer_free (ShortTimer);
  638.             gotoxy(59,8);
  639.             printsc("Completed         ");
  640.             gotoxy(59,10);
  641.             printsc("Opening door     ");
  642.             return ( 0 ) ;
  643.         }   
  644.  
  645.         if ( trStatus == trGraphicsPrompt ) {
  646.             cputs( One_liner ) ; cputs( ENTER ) ;
  647.             track_free(0);
  648.             timer_free (TimerHandle);
  649.             timer_free (ShortTimer);
  650.             gotoxy(59,8);
  651.             printsc("Completed         ");
  652.             gotoxy(59,10);
  653.             printsc("Opening door     ");
  654.             return ( 0 ) ;
  655.          }
  656.  
  657.         if ( trStatus == trNamePrompt ) {
  658.             cputs( User_Name ) ; cputs( ENTER ) ;
  659.             gotoxy(59,8);
  660.             printsc("Awaiting Password");
  661.             track_free( trNamePrompt ) ;
  662.         }
  663.  
  664.         if ( trStatus == trPWPrompt ) {
  665.             cputs( _entry_pass ) ; cputs( ENTER );
  666.             gotoxy(59,8);
  667.             printsc("Signon Complete  ");
  668.             track_free( trPWPrompt ) ;
  669.         }
  670.  
  671.         if ( trStatus == trEnterPrompt )
  672.             cputs( ENTER ) ;
  673.  
  674.         if ( trStatus == trMsgPrompt || trStatus == trMorePrompt ) {
  675.             cputs( "N" ) ; cputs( ENTER ) ;
  676.             track_free( trMsgPrompt ) ;
  677.         }
  678.  
  679.         if ( trStatus == trConfCMDPrompt ) {
  680.             cputs( "A" ) ; cputs( ENTER ) ;
  681.             track_free( trConfCMDPrompt ) ;
  682.         }
  683.  
  684.         if ( trStatus == trMainCMDPrompt ) {
  685.             track_free(0);
  686.             timer_free (TimerHandle);
  687.             timer_free (ShortTimer);
  688.             gotoxy(59,8);
  689.             printsc("Completed         ");
  690.             return ( 0 ) ;
  691.         }
  692.  
  693.         if ( trStatus == trProLogonPrompt ) {
  694.             track_free(0);
  695.             timer_free (TimerHandle);
  696.             timer_free (ShortTimer);
  697.             gotoxy(59,8);
  698.             printsc("Completed         ");
  699.             gotoxy(59,10);
  700.             printsc("Opening door     ");
  701.             cputs( hub_door ) ; cputs( ENTER ) ;
  702.             return ( 0 ) ;
  703.         }
  704.     }
  705.  
  706.     track_free( 0 ) ;
  707.     timer_free( TimerHandle ) ;
  708.     timer_free( ShortTimer  ) ;
  709. //  prints( "Logon failed - TIMEOUT" ) ;
  710.     return( -1 ) ;
  711. }
  712.  
  713. //
  714. //  Copy contents of DSZLOG to the Usage log for statistical purposes
  715. //
  716. copy_dszlog()
  717. {
  718.    fh = fopen(dszlog,"r");
  719.    fgets(logwork, 100, fh);
  720.    ustamp(logwork , 0 , 1);
  721.    fclose(fh);
  722.    del_dszlog();
  723.  
  724. }
  725.  
  726. //
  727. //    Delete DSZLOG because we do not need it anymore
  728. //
  729. del_dszlog()
  730. {
  731.    str cmdwork[100];
  732.  
  733.    cmdwork = "del ";                         // set log work with cmnd
  734.    strcat(cmdwork, dszlog);                  // add DSZLOG file name
  735.    strcat(cmdwork, " > nul");                // Add redir to null
  736.    if (filefind(dszlog, 0, logwork)) {
  737.          dos(cmdwork, 2);
  738.          Ustamp(cmdwork, 1, 0);
  739.          ustamp("  performed", 0, 1);
  740.         }
  741. }
  742.  
  743. //
  744. //   Load values from the script configuration file
  745. //
  746. load_values()
  747. {
  748. //
  749. //   Read all initialization values from CFG file
  750. //
  751.  
  752. //
  753. //   Clean up all values and save defaults
  754. //
  755.    init_values();
  756.  
  757. }
  758.  
  759. //
  760. //   Clean up all initial values before screen display
  761. //
  762. init_values()
  763. {
  764.      str portwork[1];
  765.      str cmdwork[64], cmdwork2[64];
  766.      str dir_work[64];
  767. //
  768. //   Preserve all default values
  769. //
  770.        old_alarm_on = _alarm_on;             // preserve alarm value
  771.        old_zmod_auto = _zmod_auto;           // preserve zmodem auto
  772.        old_down_dir = _down_dir;             // preserve old d/l directory
  773.        old_up_dir = _up_dir;                 // preserve old u/l directory
  774.  
  775. //
  776. //   Set up our new overrides to standard defaults
  777. //
  778.        _alarm_on = 0;                        // turn alarm off
  779.        _zmod_auto = 0;                       // turn Auto zmodem off
  780.        _down_dir = mail_download;            // set up d/l directory
  781.        _up_dir = mail_upload;                // set up u/l directory
  782. //
  783. //   Convert all variable to upper case for consistancy
  784. //
  785.        strupper(user_name);                  // convert string to upper
  786.        strupper(node_name);                  // convert string to upper
  787.        strupper(hub_name);                   // convert string to upper
  788.        strupper(_down_dir);                  // convert string to upper
  789.        strupper(_up_dir);                    // convert string to upper
  790.  
  791. //
  792. //   Build upload packet name and get it's date/time/size into variables
  793. //
  794.        up_packet = node_name;                // prime packet w/node name
  795.        strcat(up_packet, ".RLY");            // add .RLY extention
  796.  
  797.        up_file = _up_dir;                    // put in u/l dir name
  798.        strcat(up_file, up_packet);           // add packet name
  799.        if (filefind(up_file, 0, logwork))
  800.           {
  801.             n_isize = filesize(up_file);     // determine file size
  802.             itos(n_isize, node_size);        // determine file size
  803.             n_itime = filetime(up_file);     // determine file time
  804.             time(n_itime, node_time);        // determine file time
  805.             date(n_itime, node_date);        // determine file date
  806.           }
  807. //
  808. //   Build Download packet name
  809. //
  810.        Mail_packet = "IN.RLY";               // prime packet w/node name
  811.        Mail_file = _down_dir;                // put in u/l dir name
  812.        strcat(Mail_file, mail_packet);       // add packet name
  813. //
  814. //  Build the commands "j <conf> q" and "open <door>"
  815. //
  816.        strcat( Join_Command , hub_conf ) ;
  817.        strcat( Join_Command , " q ns^M" ) ;
  818.        strcat( Open_Command , hub_door ) ;
  819.        strcat( Open_Command , "^M" ) ;
  820.  
  821. //
  822. //  Build DSZ commands for mail transfer
  823. //
  824.        cmdwork = " port ";
  825.        itos((get_port()), portwork);
  826.        strcat(cmdwork, portwork);
  827.        cmdwork2 = cmdwork;
  828.        strcat(cmdwork2, " ");
  829.        strcat(cmdwork2, send_command);
  830.        strcat(cmdwork2, " ");
  831.        send_command = cmdwork2;
  832.  
  833.        cmdwork2 = cmdwork;
  834.        strcat(cmdwork2, " ");
  835.        strcat(cmdwork2, recv_command);
  836.        strcat(cmdwork2, " ");
  837.        recv_command = cmdwork2;
  838.  
  839. //
  840. // Build command line with file name for send
  841. //
  842.  strcat(Send_Command, _up_dir);              // Add upload dir to cmnd
  843.  strcat(Send_Command, up_packet);            // Add packet name to cmnd
  844. // strcat(Send_Command, " > ");                // set up redirection
  845. // strcat(Send_Command, DSZ_Screen_Log);       // add target name
  846.  
  847. //
  848. // Build command line with download directory for receive
  849. //
  850.  strcat(Recv_command, _down_dir);
  851.  strcat(Recv_command, "IN.RLY");
  852. // strcat(Recv_Command, " >> ");               // set up redirection
  853. // strcat(Recv_Command, DSZ_Screen_Log);       // add target name
  854.  
  855.  
  856. }
  857.  
  858. //
  859. //   Log to daily log the status of the file transfer
  860. //
  861. upload_log()
  862. {
  863.   message_work = "Uploading RelayNet(tm) packet: ";
  864.   strcat(message_work, up_packet);
  865.   ustamp(message_work, 1,1);
  866.  
  867.   message_work = "From directory: ";
  868.   strcat(message_work, _up_dir);
  869.   ustamp(message_work, 1,1);
  870.  
  871.   message_work = "Created on ";
  872.   strcat(message_work, node_date);
  873.   strcat(message_work, " at ");
  874.   strcat(message_work, node_time);
  875.   strcat(message_work, "   size: ");
  876.   strcat(message_work, node_size);
  877.   strcat(message_work, " bytes");
  878.   ustamp(message_work, 1,1);
  879. }
  880.  
  881. download_log()
  882. {
  883.   node_packet = "IN.RLY";               // prime packet w/node name
  884.   node_file = _down_dir;                // put in d/l dir name
  885.   strcat(node_file, node_packet);       // add packet name
  886.   n_isize = filesize(node_file);        // determine file size
  887.   itos(n_isize, node_size);             // determine file size
  888.   n_itime = filetime(node_file);        // determine file time
  889.   time(n_itime, node_time);             // determine file time
  890.   date(n_itime, node_date);             // determine file date
  891.   message_work = "Received RelayNet(tm) packet: ";
  892.   strcat(message_work, "IN.RLY");
  893.   ustamp(message_work, 1,1);
  894.  
  895.   message_work = "Into directory: ";
  896.   strcat(message_work, _up_dir);
  897.   ustamp(message_work, 1,1);
  898.  
  899.   message_work = "Created on ";
  900.   strcat(message_work, node_date);
  901.   strcat(message_work, " at ");
  902.   strcat(message_work, node_time);
  903.   strcat(message_work, "   size: ");
  904.   strcat(message_work, node_size);
  905.   strcat(message_work, " bytes");
  906.   ustamp(message_work, 1,1);
  907. }
  908.  
  909. //
  910. //  Telix file initialization
  911. //
  912. telix_init()
  913. {
  914. //
  915. //  Open a capture file for future diagnostics
  916. //
  917.     if ( ! capture_stat() )
  918.         if ( capture(  "hubrelay.cap" ) == -1 )
  919.             prints( "Unable to capture." ) ;
  920. //
  921. //  Initialize special log
  922. //
  923.     if ( usage_stat() )
  924.         usagelog( "*CLOSE*" ) ;
  925.     usagelog( mail_log_file ) ;
  926.     ustamp( "------------------------------" , 1 , 1 ) ;
  927.  
  928. //
  929. //   Delete Mail_run_good file so we won't pack and reset the messages
  930. //
  931.    if (filefind(Mail_run_good, 0, logwork)) {
  932.        logwork = "DEL ";
  933.        strcat(logwork, Mail_run_good);
  934.        strcat(logwork, "  > nul");
  935.        dos(logwork, 2);
  936.        Ustamp(logwork, 1, 0);
  937.        ustamp("  performed", 0, 1);
  938.       }
  939. }
  940.  
  941. //
  942. //   Mail preservation routine
  943. //
  944.    Mail_Save()   {
  945.  
  946.   str from_name[64],  To_name[64], command_work[127], ext_work[3];
  947.   str name_work[12];
  948.   int Work_counter;
  949.  
  950.   Work_counter = stoi(Save_count);
  951.  
  952.   If (Work_counter > 0){
  953.      gotoxy(59,13);                      // position cursor
  954.      printsc("Oldest U/L deleted");      // Mail Save status
  955.      delay(30);
  956.      itos(Work_counter, Ext_work);
  957.      name_work = node_name;
  958.      strcat(name_work, ".");
  959.      strcat(Name_work, ext_work);
  960.      command_work = "DEL ";
  961.      from_name = Mail_save_dir;
  962.      strcat(from_name, name_work);
  963.      strcat(command_work, from_name);
  964.      strcat(command_work, " > nul");
  965.      if (filefind(from_name, 0, logwork)) {
  966.          dos(command_work, 2);
  967.          Ustamp(command_work, 1, 0);
  968.          ustamp("  performed", 0, 1);
  969.         }
  970.      gotoxy(59,13);                      // position cursor
  971.      printsc("Renaming Uploads  ");   // Mail Save status
  972.      delay(30);
  973.      while(Work_counter > 1) {
  974.            itos(Work_counter, Ext_work);
  975.            name_work = Node_name;
  976.            strcat(name_work, ".");
  977.            strcat(Name_work, ext_work);
  978.            To_name = name_work;
  979.            Work_counter = Work_counter - 1;
  980.            itos(Work_counter, Ext_work);
  981.            name_work = Node_name;
  982.            strcat(name_work, ".");
  983.            strcat(Name_work, ext_work);
  984.            From_name = Mail_save_dir;
  985.            strcat(From_name, name_work);
  986.            command_work = "RENAME ";
  987.            strcat(command_work, from_name);
  988.            strcat(command_work, " ");
  989.            strcat(command_work, To_name);
  990.            strcat(command_work, " > nul");
  991.            if (filefind(from_name, 0, logwork)) {
  992.                 dos(command_work, 2);
  993.                 Ustamp(command_work, 1, 0);
  994.                 ustamp("  performed", 0, 1);
  995.                }
  996.           }
  997.      gotoxy(59,13);                      // position cursor
  998.      printsc("Copying new Upload");      // Mail Save status
  999.      delay(30);
  1000.      command_work = "COPY ";
  1001.      strcat(command_work, up_file);
  1002.      strcat(command_work, " ");
  1003.      strcat(command_work, from_name);
  1004.      strcat(command_work, " > Nul");
  1005.      dos(command_work, 2);
  1006.      Ustamp(command_work, 1, 0);
  1007.      ustamp("  performed", 0, 1);
  1008.      gotoxy(59,13);                      // position cursor
  1009.      Work_counter = stoi(Save_count);
  1010.      printsc("Delete oldest D/L ");      // Mail Save status
  1011.      delay(30);
  1012.      itos(Work_counter, Ext_work);
  1013.      name_work = "IN.";
  1014.      strcat(Name_work, ext_work);
  1015.      command_work = "DEL ";
  1016.      from_name = Mail_save_dir;
  1017.      strcat(from_name, name_work);
  1018.      strcat(command_work, from_name);
  1019.      strcat(command_work, " > nul");
  1020.      if (filefind(from_name, 0, logwork)) {
  1021.          dos(command_work, 2);
  1022.          Ustamp(command_work, 1, 0);
  1023.          ustamp("  performed", 0, 1);
  1024.         }
  1025.      gotoxy(59,13);                      // position cursor
  1026.      printsc("Renaming downloads");      // Mail Save status
  1027.      delay(30);
  1028.      while(Work_counter > 1) {
  1029.            itos(Work_counter, Ext_work);
  1030.            name_work = "IN.";
  1031.            strcat(Name_work, ext_work);
  1032.            To_name = name_work;
  1033.            Work_counter = Work_counter - 1;
  1034.            itos(Work_counter, Ext_work);
  1035.            name_work = "IN.";
  1036.            strcat(Name_work, ext_work);
  1037.            From_name = Mail_save_dir;
  1038.            strcat(From_name, name_work);
  1039.            command_work = "RENAME ";
  1040.            strcat(command_work, from_name);
  1041.            strcat(command_work, " ");
  1042.            strcat(command_work, To_name);
  1043.            strcat(command_work, " > nul");
  1044.            if (filefind(from_name, 0, logwork)) {
  1045.                dos(command_work, 2);
  1046.                Ustamp(command_work, 1, 0);
  1047.                ustamp("  performed", 0, 1);
  1048.               }
  1049.           }
  1050.      gotoxy(59,13);                      // position cursor
  1051.      printsc("Copying new download");    // Mail Save status
  1052.      delay(30);
  1053.      command_work = "COPY ";
  1054.      strcat(command_work, Mail_file);
  1055.      strcat(command_work, " ");
  1056.      strcat(command_work, from_name);
  1057.      strcat(command_work, " > Nul");
  1058.      dos(command_work, 2);
  1059.      Ustamp(command_work, 1, 0);
  1060.      ustamp("  performed", 0, 1);
  1061.     }
  1062. }
  1063.